<!DOCTYPE html>
<html lang="zh-CN">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Spring Boot集成ChatGPT API指南 | 技术小馆</title>
    <link href="https://fonts.googleapis.com/css2?family=Noto+Serif+SC:wght@400;500;600;700&family=Noto+Sans+SC:wght@300;400;500;700&display=swap" rel="stylesheet">
    <link href="https://cdn.staticfile.org/font-awesome/6.4.0/css/all.min.css" rel="stylesheet">
    <link href="https://cdn.staticfile.org/tailwindcss/2.2.19/tailwind.min.css" rel="stylesheet">
    <style>
        body {
            font-family: 'Noto Sans SC', Tahoma, Arial, Roboto, "Droid Sans", "Helvetica Neue", "Droid Sans Fallback", "Heiti SC", "Hiragino Sans GB", Simsun, sans-serif;
            line-height: 1.7;
            color: #333;
        }
        .hero {
            background: linear-gradient(135deg, #6e8efb 0%, #a777e3 100%);
        }
        .hero-title {
            text-shadow: 0 2px 4px rgba(0,0,0,0.1);
        }
        .article p {
            margin-bottom: 1.5rem;
        }
        .code-block {
            background-color: #2d2d2d;
            border-radius: 8px;
            position: relative;
        }
        .code-block pre {
            overflow-x: auto;
            padding: 1.5rem;
        }
        .code-block::before {
            content: '';
            position: absolute;
            top: 12px;
            left: 12px;
            width: 12px;
            height: 12px;
            border-radius: 50%;
            background: #ff5f56;
            box-shadow: 20px 0 0 #ffbd2e, 40px 0 0 #27c93f;
        }
        .step-card {
            transition: all 0.3s ease;
            border-left: 4px solid #6e8efb;
        }
        .step-card:hover {
            transform: translateY(-5px);
            box-shadow: 0 10px 20px rgba(0,0,0,0.1);
        }
        .section-divider {
            border: none;
            height: 1px;
            background: linear-gradient(90deg, rgba(110,142,251,0.1) 0%, rgba(110,142,251,0.8) 50%, rgba(110,142,251,0.1) 100%);
        }
        .note-box {
            background-color: rgba(167, 119, 227, 0.1);
            border-left: 4px solid #a777e3;
        }
        .warning-box {
            background-color: rgba(255, 193, 7, 0.1);
            border-left: 4px solid #ffc107;
        }
        .footer {
            background-color: #1a1a1a;
        }
        .hover-scale {
            transition: transform 0.3s ease;
        }
        .hover-scale:hover {
            transform: scale(1.02);
        }
    </style>
</head>
<body class="bg-gray-50">
    <!-- Hero Section -->
    <section class="hero text-white py-20 px-4">
        <div class="container mx-auto max-w-5xl">
            <div class="flex flex-col items-center text-center">
                <h1 class="hero-title text-4xl md:text-5xl font-bold mb-6 leading-tight">
                    Spring Boot集成ChatGPT API开发指南
                </h1>
                <p class="text-xl md:text-2xl opacity-90 max-w-3xl mb-8">
                    全面解析如何使用Spring Boot构建调用ChatGPT API的后端服务
                </p>
                <div class="flex space-x-4">
                    <span class="px-4 py-2 bg-white bg-opacity-20 rounded-full">Spring Boot</span>
                    <span class="px-4 py-2 bg-white bg-opacity-20 rounded-full">ChatGPT</span>
                    <span class="px-4 py-2 bg-white bg-opacity-20 rounded-full">API开发</span>
                </div>
            </div>
        </div>
    </section>

    <!-- Main Content -->
    <main class="container mx-auto max-w-5xl px-4 py-12">
        <article class="article bg-white rounded-xl shadow-md overflow-hidden hover-scale">
            <!-- Introduction -->
            <div class="p-8">
                <p class="text-lg text-gray-700 mb-6">
                    随着OpenAI的ChatGPT API提供强大的自然语言处理能力，开发者可以轻松将其集成到自己的应用中。本篇文章将详细讲解如何使用<strong>Spring Boot</strong>构建一个调用ChatGPT API的后端服务，从配置环境到实现功能，帮助开发者快速上手并用好这一技术。
                </p>
                
                <!-- Table of Contents -->
                <div class="bg-gray-50 p-6 rounded-lg mb-8">
                    <h3 class="text-xl font-semibold mb-4 text-gray-800 flex items-center">
                        <i class="fas fa-list-ol mr-2 text-purple-600"></i> 文章目录
                    </h3>
                    <ol class="list-decimal pl-6 space-y-2">
                        <li><a href="#section-preparation" class="text-blue-600 hover:text-blue-800">准备工作</a></li>
                        <li><a href="#section-create-project" class="text-blue-600 hover:text-blue-800">创建Spring Boot项目</a></li>
                        <li><a href="#section-configuration" class="text-blue-600 hover:text-blue-800">项目配置</a></li>
                        <li><a href="#section-implementation" class="text-blue-600 hover:text-blue-800">实现ChatGPT接口调用</a></li>
                        <li><a href="#section-testing" class="text-blue-600 hover:text-blue-800">运行与测试</a></li>
                        <li><a href="#section-optimization" class="text-blue-600 hover:text-blue-800">优化与扩展</a></li>
                    </ol>
                </div>
            </div>

            <hr class="section-divider">

            <!-- Section 1: Preparation -->
            <section id="section-preparation" class="p-8">
                <h2 class="text-2xl font-bold mb-6 text-gray-800 flex items-center">
                    <span class="w-8 h-8 bg-purple-600 text-white rounded-full flex items-center justify-center mr-3">1</span>
                    准备工作
                </h2>
                <p class="mb-6">在开始之前，需要完成以下准备工作：</p>

                <div class="grid md:grid-cols-2 gap-6 mb-8">
                    <!-- Card 1 -->
                    <div class="step-card bg-white p-6 rounded-lg shadow hover:shadow-md">
                        <h3 class="text-xl font-semibold mb-3 text-gray-800 flex items-center">
                            <i class="fas fa-key mr-2 text-blue-500"></i> 申请OpenAI API Key
                        </h3>
                        <p class="text-gray-700 mb-4">
                            注册OpenAI账号，并在 <a href="https://platform.openai.com/signup/" class="text-blue-600 hover:underline">OpenAI API控制台</a> 中生成一个API密钥。此密钥将用于访问ChatGPT服务。
                        </p>
                        <div class="bg-gray-100 p-4 rounded-lg">
                            <img src="https://cdn.nlark.com/yuque/0/2024/png/21449790/1734143427446-7dcf97ff-fb0b-454b-a95e-76d179c776e8.png" alt="OpenAI API Key截图" class="rounded border border-gray-200">
                        </div>
                    </div>

                    <!-- Card 2 -->
                    <div class="step-card bg-white p-6 rounded-lg shadow hover:shadow-md">
                        <h3 class="text-xl font-semibold mb-3 text-gray-800 flex items-center">
                            <i class="fas fa-laptop-code mr-2 text-green-500"></i> 开发环境要求
                        </h3>
                        <ul class="list-disc pl-5 space-y-2 text-gray-700">
                            <li>JDK 8或更高版本</li>
                            <li>Maven或Gradle构建工具</li>
                            <li>IDE（如IntelliJ IDEA、Eclipse）</li>
                        </ul>
                    </div>
                </div>
            </section>

            <hr class="section-divider">

            <!-- Section 2: Create Project -->
            <section id="section-create-project" class="p-8">
                <h2 class="text-2xl font-bold mb-6 text-gray-800 flex items-center">
                    <span class="w-8 h-8 bg-purple-600 text-white rounded-full flex items-center justify-center mr-3">2</span>
                    创建Spring Boot项目
                </h2>

                <div class="grid md:grid-cols-1 gap-6 mb-8">
                    <div class="step-card bg-white p-6 rounded-lg shadow hover:shadow-md">
                        <h3 class="text-xl font-semibold mb-3 text-gray-800 flex items-center">
                            <i class="fas fa-rocket mr-2 text-red-500"></i> 2.1 使用Spring Initializer创建项目
                        </h3>
                        <p class="text-gray-700 mb-4">
                            访问 <a href="https://start.spring.io/" class="text-blue-600 hover:underline">Spring Initializer</a> 配置并下载项目：
                        </p>
                        <ul class="list-disc pl-5 space-y-2 text-gray-700 mb-4">
                            <li>项目类型：Maven Project</li>
                            <li>语言：Java</li>
                            <li>Spring Boot版本：选择最新稳定版本</li>
                            <li>依赖项：<code class="bg-gray-100 px-2 py-1 rounded">Spring Web</code>, <code class="bg-gray-100 px-2 py-1 rounded">Spring Boot DevTools</code>, <code class="bg-gray-100 px-2 py-1 rounded">Spring Configuration Processor</code></li>
                        </ul>
                        <div class="note-box p-4 rounded-lg mb-4">
                            <p class="text-gray-700 flex items-start">
                                <i class="fas fa-info-circle mr-2 text-purple-600 mt-1"></i>
                                也可以直接在IDE中创建Spring Boot项目，大多数现代IDE都集成了Spring Initializer功能。
                            </p>
                        </div>
                    </div>

                    <div class="step-card bg-white p-6 rounded-lg shadow hover:shadow-md">
                        <h3 class="text-xl font-semibold mb-3 text-gray-800 flex items-center">
                            <i class="fas fa-download mr-2 text-orange-500"></i> 2.2 导入项目到IDE
                        </h3>
                        <p class="text-gray-700">
                            将下载的项目解压并导入到IDE中，确保Maven或Gradle能正确加载依赖。建议等待索引完成后再进行下一步操作。
                        </p>
                    </div>
                </div>
            </section>

            <hr class="section-divider">

            <!-- Section 3: Configuration -->
            <section id="section-configuration" class="p-8">
                <h2 class="text-2xl font-bold mb-6 text-gray-800 flex items-center">
                    <span class="w-8 h-8 bg-purple-600 text-white rounded-full flex items-center justify-center mr-3">3</span>
                    项目配置
                </h2>

                <div class="grid md:grid-cols-2 gap-6 mb-8">
                    <div class="step-card bg-white p-6 rounded-lg shadow hover:shadow-md">
                        <h3 class="text-xl font-semibold mb-3 text-gray-800 flex items-center">
                            <i class="fas fa-cogs mr-2 text-blue-500"></i> 3.1 添加必要依赖
                        </h3>
                        <p class="text-gray-700 mb-4">
                            在<code>pom.xml</code>中添加以下依赖：
                        </p>
                        <div class="code-block mb-4">
                            <pre class="text-gray-300"><code class="language-xml">&lt;dependencies&gt;
    &lt;!-- Spring Boot Web --&gt;
    &lt;dependency&gt;
        &lt;groupId&gt;org.springframework.boot&lt;/groupId&gt;
        &lt;artifactId&gt;spring-boot-starter-web&lt;/artifactId&gt;
    &lt;/dependency&gt;

    &lt;!-- JSON 处理工具 --&gt;
    &lt;dependency&gt;
        &lt;groupId&gt;com.fasterxml.jackson.core&lt;/groupId&gt;
        &lt;artifactId&gt;jackson-databind&lt;/artifactId&gt;
    &lt;/dependency&gt;

    &lt;!-- Lombok --&gt;
    &lt;dependency&gt;
        &lt;groupId&gt;org.projectlombok&lt;/groupId&gt;
        &lt;artifactId&gt;lombok&lt;/artifactId&gt;
        &lt;scope&gt;provided&lt;/scope&gt;
    &lt;/dependency&gt;
&lt;/dependencies&gt;</code></pre>
                        </div>
                        <p class="text-gray-700">
                            运行<code class="bg-gray-100 px-2 py-1 rounded">mvn install</code>更新依赖。
                        </p>
                    </div>

                    <div class="step-card bg-white p-6 rounded-lg shadow hover:shadow-md">
                        <h3 class="text-xl font-semibold mb-3 text-gray-800 flex items-center">
                            <i class="fas fa-file-alt mr-2 text-green-500"></i> 3.2 配置文件
                        </h3>
                        <p class="text-gray-700 mb-4">
                            在<code>src/main/resources/application.properties</code>中，添加OpenAI API的相关配置：
                        </p>
                        <div class="code-block mb-4">
                            <pre class="text-gray-300"><code class="language-properties"># OpenAI API 配置
openai.api.key=YOUR_OPENAI_API_KEY
openai.api.url=https://api.openai.com/v1/chat/completions</code></pre>
                        </div>
                        <p class="text-gray-700">
                            将<code class="bg-gray-100 px-2 py-1 rounded">YOUR_OPENAI_API_KEY</code>替换为实际的API密钥。
                        </p>
                    </div>
                </div>
            </section>

            <hr class="section-divider">

            <!-- Section 4: Implementation -->
            <section id="section-implementation" class="p-8">
                <h2 class="text-2xl font-bold mb-6 text-gray-800 flex items-center">
                    <span class="w-8 h-8 bg-purple-600 text-white rounded-full flex items-center justify-center mr-3">4</span>
                    实现ChatGPT接口调用
                </h2>

                <div class="grid md:grid-cols-1 gap-6 mb-8">
                    <div class="step-card bg-white p-6 rounded-lg shadow hover:shadow-md">
                        <h3 class="text-xl font-semibold mb-3 text-gray-800 flex items-center">
                            <i class="fas fa-code mr-2 text-red-500"></i> 4.1 创建配置类
                        </h3>
                        <div class="code-block mb-4">
                            <pre class="text-gray-300"><code class="language-java">import org.springframework.beans.factory.annotation.Value;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.web.client.RestTemplate;

@Configuration
public class OpenAIConfig {

    @Value("${openai.api.key}")
    private String apiKey;

    @Value("${openai.api.url}")
    private String apiUrl;

    @Bean
    public RestTemplate restTemplate() {
        return new RestTemplate();
    }

    public String getApiKey() {
        return apiKey;
    }

    public String getApiUrl() {
        return apiUrl;
    }
}</code></pre>
                        </div>
                    </div>

                    <div class="step-card bg-white p-6 rounded-lg shadow hover:shadow-md">
                        <h3 class="text-xl font-semibold mb-3 text-gray-800 flex items-center">
                            <i class="fas fa-file-code mr-2 text-orange-500"></i> 4.2 创建请求和响应模型
                        </h3>
                        <p class="text-gray-700 mb-4">
                            <strong>请求模型：</strong>
                        </p>
                        <div class="code-block mb-6">
                            <pre class="text-gray-300"><code class="language-java">import lombok.Data;
import java.util.List;

@Data
public class ChatGPTRequest {
    private String model;
    private List&lt;Message&gt; messages;

    @Data
    public static class Message {
        private String role; // "system", "user", or "assistant"
        private String content;
    }
}</code></pre>
                        </div>
                        <p class="text-gray-700 mb-4">
                            <strong>响应模型：</strong>
                        </p>
                        <div class="code-block mb-4">
                            <pre class="text-gray-300"><code class="language-java">import lombok.Data;
import java.util.List;

@Data
public class ChatGPTResponse {
    private List&lt;Choice&gt; choices;

    @Data
    public static class Choice {
        private Message message;

        @Data
        public static class Message {
            private String role;
            private String content;
        }
    }
}</code></pre>
                        </div>
                    </div>

                    <div class="step-card bg-white p-6 rounded-lg shadow hover:shadow-md">
                        <h3 class="text-xl font-semibold mb-3 text-gray-800 flex items-center">
                            <i class="fas fa-cogs mr-2 text-blue-500"></i> 4.3 实现服务类
                        </h3>
                        <div class="code-block mb-4">
                            <pre class="text-gray-300"><code class="language-java">import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.web.client.RestTemplate;

@Service
public class ChatGPTService {

    @Autowired
    private RestTemplate restTemplate;

    @Autowired
    private OpenAIConfig openAIConfig;

    public String getChatGPTResponse(String userInput) {
        // 构建请求体
        ChatGPTRequest request = new ChatGPTRequest();
        request.setModel("gpt-3.5-turbo");
        ChatGPTRequest.Message message = new ChatGPTRequest.Message();
        message.setRole("user");
        message.setContent(userInput);
        request.setMessages(List.of(message));

        // 设置请求头
        HttpHeaders headers = new HttpHeaders();
        headers.setContentType(MediaType.APPLICATION_JSON);
        headers.setBearerAuth(openAIConfig.getApiKey());

        HttpEntity&lt;ChatGPTRequest&gt; httpEntity = new HttpEntity&lt;&gt;(request, headers);

        // 发送请求
        ResponseEntity&lt;ChatGPTResponse&gt; responseEntity = restTemplate.postForEntity(
                openAIConfig.getApiUrl(),
                httpEntity,
                ChatGPTResponse.class
        );

        // 解析响应
        return responseEntity.getBody()
                .getChoices()
                .get(0)
                .getMessage()
                .getContent();
    }
}</code></pre>
                        </div>
                    </div>

                    <div class="step-card bg-white p-6 rounded-lg shadow hover:shadow-md">
                        <h3 class="text-xl font-semibold mb-3 text-gray-800 flex items-center">
                            <i class="fas fa-terminal mr-2 text-green-500"></i> 4.4 创建控制器
                        </h3>
                        <div class="code-block mb-4">
                            <pre class="text-gray-300"><code class="language-java">import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

@RestController
@RequestMapping("/api/chatgpt")
public class ChatGPTController {

    @Autowired
    private ChatGPTService chatGPTService;

    @PostMapping("/ask")
    public String askChatGPT(@RequestBody String userInput) {
        return chatGPTService.getChatGPTResponse(userInput);
    }
}</code></pre>
                        </div>
                    </div>
                </div>
            </section>

            <hr class="section-divider">

            <!-- Section 5: Testing -->
            <section id="section-testing" class="p-8">
                <h2 class="text-2xl font-bold mb-6 text-gray-800 flex items-center">
                    <span class="w-8 h-8 bg-purple-600 text-white rounded-full flex items-center justify-center mr-3">5</span>
                    运行项目并测试
                </h2>

                <div class="grid md:grid-cols-2 gap-6 mb-8">
                    <div class="step-card bg-white p-6 rounded-lg shadow hover:shadow-md">
                        <h3 class="text-xl font-semibold mb-3 text-gray-800 flex items-center">
                            <i class="fas fa-play mr-2 text-red-500"></i> 5.1 启动服务
                        </h3>
                        <p class="text-gray-700">
                            运行<code class="bg-gray-100 px-2 py-1 rounded">Application</code>类，确保Spring Boot服务成功启动。控制台应显示类似以下信息：
                        </p>
                        <div class="code-block mt-4">
                            <pre class="text-gray-300"><code class="language-shell">Started Application in 3.456 seconds (JVM running for 4.123)</code></pre>
                        </div>
                    </div>

                    <div class="step-card bg-white p-6 rounded-lg shadow hover:shadow-md">
                        <h3 class="text-xl font-semibold mb-3 text-gray-800 flex items-center">
                            <i class="fas fa-vial mr-2 text-blue-500"></i> 5.2 测试接口
                        </h3>
                        <p class="text-gray-700 mb-4">
                            使用Postman或curl测试接口：
                        </p>
                        <div class="code-block mb-4">
                            <pre class="text-gray-300"><code class="language-json">URL: http://localhost:8080/api/chatgpt/ask
请求方法: POST
请求体:
"请为我解释一下什么是人工智能。"</code></pre>
                        </div>
                        <p class="text-gray-700 mb-2">
                            响应示例：
                        </p>
                        <div class="code-block">
                            <pre class="text-gray-300"><code class="language-json">"人工智能（AI）是一种模拟人类智能的技术，允许机器执行复杂任务……"</code></pre>
                        </div>
                    </div>
                </div>

                <div class="warning-box p-6 rounded-lg mb-8">
                    <h4 class="font-semibold text-lg mb-3 flex items-center">
                        <i class="fas fa-exclamation-triangle mr-2 text-yellow-600"></i> 常见问题
                    </h4>
                    <div class="code-block mb-4">
                        <pre class="text-gray-300"><code class="language-xml">org.springframework.web.client.HttpClientErrorException$TooManyRequests: 429 Too Many Requests on POST request for "https://api.openai.com/v1/chat/completions": "{<EOL>    "error": {<EOL>        "message": "You exceeded your current quota, please check your plan and billing details. For more information on this error, read the docs: https://platform.openai.com/docs/guides/error-codes/api-errors.",<EOL>        "type": "insufficient_quota",<EOL>        "param": null,<EOL>        "code": "insufficient_quota"<EOL>    }<EOL>}<EOL>"</code></pre>
                    </div>
                    <p class="text-gray-700">
                        出现以上问题说明你的API_KEY有问题，一个新注册的ChatGPT/OpenAI账户会有一定量的免费测试额度（极少），供用户调用OpenAI的API以用来测试。因此通常在用一段时间后，免费额度用完，再次调用API时就会出现如下报错：you exceeded your current quota, please check your plan and billing details。意思是免费的额度用完了，再用就需要花钱了。
                    </p>
                    <p class="text-gray-700 mt-4 font-medium">
                        解决方法：
                    </p>
                    <p class="text-gray-700">
                        此时有两个解决办法，一是重新注册一个新的账户，此时就又可以白嫖一定额度了。另一种上淘宝用2块钱买一个APIKEY也可以用一段时间。
                    </p>
                    <p class="text-gray-700 mt-4">
                        <i class="fas fa-info-circle mr-2"></i>
                        调用过程要用到VPN，没有的可以找我给你推荐个稳定的。
                    </p>
                </div>
            </section>

            <hr class="section-divider">

            <!-- Section 6: Optimization -->
            <section id="section-optimization" class="p-8">
                <h2 class="text-2xl font-bold mb-6 text-gray-800 flex items-center">
                    <span class="w-8 h-8 bg-purple-600 text-white rounded-full flex items-center justify-center mr-3">6</span>
                    优化与扩展
                </h2>

                <div class="grid md:grid-cols-2 gap-6">
                    <div class="step-card bg-white p-6 rounded-lg shadow hover:shadow-md">
                        <h3 class="text-xl font-semibold mb-3 text-gray-800 flex items-center">
                            <i class="fas fa-bolt mr-2 text-green-500"></i> 6.1 异步调用
                        </h3>
                        <p class="text-gray-700">
                            使用<code class="bg-gray-100 px-2 py-1 rounded">CompletableFuture</code>或<code class="bg-gray-100 px-2 py-1 rounded">@Async</code>注解，将ChatGPT请求改为异步执行，提高服务性能。
                        </p>
                    </div>

                    <div class="step-card bg-white p-6 rounded-lg shadow hover:shadow-md">
                        <h3 class="text-xl font-semibold mb-3 text-gray-800 flex items-center">
                            <i class="fas fa-database mr-2 text-blue-500"></i> 6.2 缓存机制
                        </h3>
                        <p class="text-gray-700">
                            对于重复性高的请求，添加缓存机制（如Redis）以减少API调用次数。
                        </p>
                    </div>

                    <div class="step-card bg-white p-6 rounded-lg shadow hover:shadow-md">
                        <h3 class="text-xl font-semibold mb-3 text-gray-800 flex items-center">
                            <i class="fas fa-desktop mr-2 text-purple-500"></i> 6.3 提供前端支持
                        </h3>
                        <p class="text-gray-700">
                            使用Vue.js或React构建前端界面，通过RESTful API提供交互式ChatGPT聊天功能。
                        </p>
                    </div>

                    <div class="step-card bg-white p-6 rounded-lg shadow hover:shadow-md">
                        <h3 class="text-xl font-semibold mb-3 text-gray-800 flex items-center">
                            <i class="fas fa-exchange-alt mr-2 text-orange-500"></i> 6.4 模型切换
                        </h3>
                        <p class="text-gray-700">
                            支持用户动态选择模型（如<code class="bg-gray-100 px-2 py-1 rounded">gpt-4</code>或更高版本），增强灵活性。
                        </p>
                    </div>
                </div>
            </section>
        </article>
    </main>

    <!-- Footer -->
    <footer class="footer text-white py-8">
        <div class="container mx-auto max-w-5xl px-4">
            <div class="flex flex-col md:flex-row justify-between items-center">
                <div class="mb-4 md:mb-0">
                    <h3 class="text-xl font-bold">技术小馆</h3>
                    <p class="text-gray-400">专注技术分享与实践</p>
                </div>
                <div>
                    <a href="http://www.yuque.com/jtostring" class="text-gray-300 hover:text-white transition-colors duration-300">
                        <i class="fas fa-globe mr-2"></i> http://www.yuque.com/jtostring
                    </a>
                </div>
            </div>
            <div class="border-t border-gray-700 mt-6 pt-6 text-center text-gray-400 text-sm">
                &copy; 2023 技术小馆. 保留所有权利.
            </div>
        </div>
    </footer>

    <script src="https://cdn.jsdelivr.net/npm/mermaid@latest/dist/mermaid.min.js"></script>
    <script>
        mermaid.initialize({
            startOnLoad: true,
            theme: 'default',
            flowchart: {
                useMaxWidth: true,
                htmlLabels: true,
                curve: 'basis'
            }
        });
    </script>
</body>
</html>
```